package com.anfeng.cms.config;

import com.anfeng.cms.filter.AuthFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;

/**
 * @author 吴朋
 * @date 2019/7/16
 */
@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean testFilterRegistration() {

        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(authFilter());
        registration.addUrlPatterns("/*");
        registration.setName("authFilter");
        return registration;
    }
    @Bean
    public Filter authFilter(){
        return new AuthFilter();
    }
}
